#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <errno.h>
#include<unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include"Common.hpp"

//读取文件写入命名管道
int main()
{
   int fifo = mkfifo("tp",0664);

   int infd = open("abc",O_RDONLY);
   if(infd<0) ERR_EXIT("open");

   int outfd = open("tp",O_WRONLY);
   if(outfd<0) ERR_EXIT("open");

   char buffer[1024];
   int n;
   while((n=read(infd,buffer,sizeof(buffer)))>0)
   {
       write(outfd,buffer,n);
   }

   close(infd);
   close(outfd);
   return 0;
}